home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / cvs / sprite / RCS / checkin.csh,v < prev    next >
Encoding:
Text File  |  1991-07-29  |  8.4 KB  |  318 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @# @;
  7.  
  8.  
  9. 1.2
  10. date     91.07.29.11.52.39;  author jhh;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     91.07.10.23.24.22;  author jhh;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24. 1.2
  25. log
  26. @sprite path different, no /dev/tty, .SH files are sh scripts
  27. @
  28. text
  29. @#!/bin/csh
  30. #
  31. # $Id: checkin.csh,v 1.1 91/07/10 23:24:22 jhh Exp Locker: jhh $
  32. #
  33. #   Copyright (c) 1989, Brian Berliner
  34. #
  35. #   You may distribute under the terms of the GNU General Public License
  36. #   as specified in the README file that comes with the CVS 1.0 kit.
  37. #
  38. #############################################################################
  39. #                                        #
  40. # This script is used to check in sources from vendors.              #
  41. #                                        #
  42. #    Usage: checkin repository Vendor_Tag Vendor_Release_Tag            #
  43. #                                        #
  44. # The repository is the directory where the sources should            #
  45. # be deposited, the Vendor_Tag is the symbolic tag for the             #
  46. # vendor branch of the RCS release tree, and the Vendor_Release_Tag        #
  47. # is the symbolic tag for this release.                      #
  48. #                                        #
  49. # checkin traverses the current directory, ensuring that an             #
  50. # identical directory structure exists in the repository directory.  It        #
  51. # then checks the files in in the following manner:                #
  52. #                                        #
  53. #        1) If the file doesn't yet exist, check it in             #
  54. #            as revision 1.1                        #
  55. #        2) Tag branch 1.1.1 with the vendor tag                #
  56. #        3) Check the file into the vendor branch,             #
  57. #            labeling it with the Vendor_Release_Tag            #
  58. #        4) If the file didn't previously exist,             #
  59. #            make the vendor branch the default branch        #
  60. #                                        #
  61. # The script also is somewhat verbose in letting the user know what is        #
  62. # going on.  It prints a diagnostic when it creates a new file, or updates  #
  63. # a file that has been modified on the trunk.                       #
  64. #                                        #
  65. #############################################################################
  66.  
  67. set vbose = 0
  68. set message = ""
  69. set cvsbin = /sprite/cmds
  70. set rcsbin = /sprite/cmds
  71. set grep = /sprite/cmds/grep
  72. set message_file = /tmp/checkin.$$
  73. set got_one = 0
  74.  
  75. if ( $#argv < 3 ) then
  76.     echo "Usage: checkin [-v] [-m message] [-f message_file] repository"
  77.     echo "    Vendor_Tag Vendor_Release_Tag [Vendor_Release_tag...]"
  78.     exit 1
  79. endif
  80. while ( $#argv )
  81.     switch ( $argv[1] )
  82.         case -v:
  83.             set vbose = 1
  84.         breaksw
  85.     case -m:
  86.         shift
  87.         echo $argv[1] > $message_file
  88.         set got_one = 1
  89.         breaksw
  90.     case -f:
  91.         shift
  92.         set message_file = $argv[1]
  93.         set got_one = 2
  94.         breaksw
  95.     default:
  96.         break
  97.     endsw
  98.     shift
  99. end
  100. if ( $#argv < 3 ) then
  101.     echo "Usage: checkin [-v] [-m message] [-f message_file] repository"
  102.     echo "    Vendor_Tag Vendor_Release_Tag [Vendor_Release_tag...]"
  103.     exit 1
  104. endif
  105. set repository = $argv[1]
  106. shift
  107. set vendor = $argv[1]
  108. shift
  109. set release = $argv[1]
  110. shift
  111. set extra_release = ( $argv )
  112.  
  113. if ( ! $?CVSROOT ) then
  114.     echo "Please set the environmental variable CVSROOT to the root"
  115.     echo "    of the tree you wish to update"
  116.     exit 1
  117. endif
  118.  
  119. if ( $got_one == 0 ) then
  120.     echo "You must use either the -m or -f option"
  121.     exit 1
  122. endif
  123.  
  124. umask 2
  125.  
  126. set update_dir = ${CVSROOT}/${repository}
  127. if ( -d SCCS ) then
  128.     sccs get SCCS/* >& /dev/null
  129. endif
  130. if ( -d RCS ) then
  131.     $rcsbin/co RCS/* >& /dev/null
  132. endif
  133. foreach name ( * .[a-zA-Z0-9]* )
  134.     if ( $name == SCCS ) then 
  135.     continue
  136.     endif
  137.     if ( $name == RCS ) then 
  138.     continue
  139.     endif
  140.     if ( $vbose ) then 
  141.     echo "Updating ${repository}/${name}"
  142.     endif
  143.     if ( -d $name ) then
  144.     if ( ! -d ${update_dir}/${name} ) then
  145.         echo "WARNING: Creating new directory ${repository}/${name}"
  146.         mkdir ${update_dir}/${name}
  147.         if ( $status ) then
  148.         echo "ERROR: mkdir failed - aborting"
  149.         exit 1
  150.         endif
  151.     endif
  152.     chdir $name
  153.     if ( $status ) then
  154.         echo "ERROR: Couldn\'t chdir to $name - aborting" 
  155.         exit 1
  156.     endif
  157.     if ( $vbose ) then
  158.         $cvsbin/checkin -v -f $message_file ${repository}/${name} $vendor $release $extra_release
  159.     else
  160.         $cvsbin/checkin -f $message_file ${repository}/${name} $vendor $release $extra_release
  161.     endif
  162.     if ( $status ) then 
  163.         exit 1
  164.     endif
  165.     chdir ..
  166.     else
  167.     if ( ! -f $name ) then
  168.         echo "WARNING: $name is neither a regular file" 
  169.         echo "       nor a directory - ignored"
  170.         continue
  171.     endif
  172.     set file = ${update_dir}/${name},v
  173.     set new = 0
  174.     set comment = ""
  175.     grep -s '\$Log.*\$' ${name}
  176.     if ( $status == 0 ) then
  177.         set myext = ${name:e}
  178.         set knownext = 0
  179.         foreach xx ( "c" "csh" "e" "f" "h" "l" "mac" "me" "mm" "ms" "p" "r" "red" "s" "sh" "sl" "cl" "ml" "el" "tex" "y" "ye" "yr" "" "SH")
  180.         if ( "${myext}" == "${xx}" ) then
  181.             set knownext = 1
  182.             break
  183.         endif
  184.         end
  185.         if ( $knownext == 0 ) then
  186.         echo For file ${file}:
  187.         grep '\$Log.*\$' ${name}
  188.         echo -n "Please insert a comment leader for file ${name} > "
  189.         set comment = $<
  190.         endif
  191.     endif
  192.     if ( ! -f $file ) then
  193.         if ( ! -f ${update_dir}/Attic/${name},v ) then
  194.             echo "WARNING: Creating new file ${repository}/${name}"
  195.         if ( "${comment}" != "" ) then
  196.             $rcsbin/rcs -q -i -c"${comment}" -t/dev/null $file
  197.         endif
  198.             $rcsbin/ci -q -u1.1 -t/dev/null $file 
  199.             if ( $status ) then
  200.             echo "ERROR: Initial check-in of $file failed - aborting"
  201.             exit 1
  202.             endif
  203.             set new = 1
  204.         else 
  205.         set file = ${update_dir}/Attic/${name},v
  206.         echo "WARNING: Updating ${repository}/Attic/${name}"
  207.             set headbranch = `sed -n '/^head/p; /^branch/p; 2q' $file`
  208.             if ( $#headbranch != 2 && $#headbranch != 4 ) then
  209.             echo "ERROR: corrupted RCS file $file - aborting"
  210.             endif
  211.         set head = "$headbranch[2]"
  212.         set branch = ""
  213.         if ( $#headbranch == 4 ) then
  214.             set branch = "$headbranch[4]"
  215.         endif
  216.             if ( "$head" == "1.1;" && "$branch" != "1.1.1;" ) then
  217.             ${rcsbin}/rcsdiff -q -r1.1 $file > /dev/null
  218.             if ( ! $status ) then
  219.                 set new = 1
  220.             endif
  221.             else
  222.                 if ( "$branch" != "1.1.1;" ) then
  223.                 echo -n "WARNING: Updating locally modified file "
  224.             echo    "${repository}/Attic/${name}"
  225.                 endif
  226.             endif
  227.         endif
  228.     else
  229.         set headbranch = `sed -n '/^head/p; /^branch/p; 2q' $file`
  230.         if ( $#headbranch != 2 && $#headbranch != 4 ) then
  231.         echo "ERROR: corrupted RCS file $file - aborting"
  232.         endif
  233.         set head = "$headbranch[2]"
  234.         set branch = ""
  235.         if ( $#headbranch == 4 ) then
  236.         set branch = "$headbranch[4]"
  237.         endif
  238.         if ( "$head" == "1.1;" && "$branch" != "1.1.1;" ) then
  239.         ${rcsbin}/rcsdiff -q -r1.1 $file > /dev/null
  240.         if ( ! $status ) then
  241.             set new = 1
  242.         endif
  243.         else
  244.             if ( "$branch" != "1.1.1;" ) then
  245.             echo -n "WARNING: Updating locally modified file "
  246.             echo    "${repository}/${name}"
  247.             endif
  248.         endif
  249.     endif
  250.     $rcsbin/rcs -q -N${vendor}:1.1.1 $file
  251.     if ( $status ) then
  252.         echo "ERROR: Attempt to set Vendor_Tag in $file failed - aborting"
  253.         exit 1
  254.     endif
  255.     set lock_failed = 0
  256.     $rcsbin/rcs -q -l${vendor} $file >& /dev/null
  257.     if ( $status ) then
  258.         set lock_failed = 1
  259.     endif
  260.     if ( "${comment}" != "" ) then
  261.         $rcsbin/rcs -q -c"${comment}" $file
  262.     endif
  263.     $rcsbin/ci -q -f -u${vendor} -N${release} $file < $message_file 
  264.     if ( $status ) then
  265.         echo "ERROR: Check-in of $file failed - aborting"
  266.         if ( ! $lock_failed ) then
  267.             $rcsbin/rcs -q -u${vendor} $file
  268.         endif
  269.         exit 1
  270.     endif
  271.     foreach tag ( $extra_release )
  272.         $rcsbin/rcs -q -N${tag}:${release} $file
  273.         if ( $status ) then
  274.         echo "ERROR: Couldn't add tag $tag to file $file"
  275.         continue
  276.         endif
  277.     end
  278.     if ( $new ) then
  279.         $rcsbin/rcs -q -b${vendor} $file
  280.         if ( $status ) then
  281.         echo "ERROR: Attempt to change default branch failed - aborting"
  282.         exit 1
  283.         endif
  284.     endif
  285.     endif
  286. end
  287. if ( $got_one == 1 ) rm $message_file
  288. @
  289.  
  290.  
  291. 1.1
  292. log
  293. @Initial revision
  294. @
  295. text
  296. @d3 1
  297. a3 1
  298. # $Id: checkin.csh,v 1.8.1.1 91/01/18 12:06:34 berliner Exp $
  299. d41 3
  300. a43 3
  301. set cvsbin = /usr/local/bin
  302. set rcsbin = /usr/local/bin
  303. set grep = /bin/grep
  304. d92 2
  305. a93 8
  306.     echo "Please Edit this file to contain the RCS log information" >$message_file
  307.     echo "to be associated with this file (please remove these lines)">>$message_file
  308.     if ( $?EDITOR ) then
  309.     $EDITOR $message_file > /dev/tty
  310.     else
  311.     /usr/ucb/vi $message_file > /dev/tty
  312.     endif
  313.     set got_one = 1
  314. d151 1
  315. a151 1
  316.         foreach xx ( "c" "csh" "e" "f" "h" "l" "mac" "me" "mm" "ms" "p" "r" "red" "s" "sh" "sl" "cl" "ml" "el" "tex" "y" "ye" "yr" "" )
  317. @
  318.